C51 COMPILER V7.06   SM_EEPROM                                                             10/31/2008 13:27:11 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE SM_EEPROM
OBJECT MODULE PLACED IN .\OUT\SM_EEPROM.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE SM_EEPROM.c BROWSE DEBUG OBJECTEXTEND PRINT(.\LST\SM_EEPROM.lst) OBJECT(.\O
                    -UT\SM_EEPROM.obj)

stmt level    source

   1          #include "sm59d04g2sfr.h"
   2          #include "DEFINE.h"
   3          
   4          //===============================
   5          
   6          //==============================
   7          
   8          #define ISP_IAP_BYTE_PROGRAM 0x80   //
   9          #define ISP_IAP_SECTOR_ERASE 0x82   //
  10          
  11          uchar isp_read_byte(uint add)
  12          {
  13   1      
  14   1          unsigned char code *tempP;
  15   1                      unsigned char rdata;
  16   1              tempP = add+0x3000;
  17   1                      rdata = *tempP; 
  18   1              return rdata;
  19   1       
  20   1      }
  21          //=========================================================================
  22          // ISP Enable
  23          //=========================================================================
  24          
  25          void EEPROM_Enable(void)
  26          {
  27   1              ISPFD = 0x55;                   // Enable ISP function key
  28   1              ISPFD = 0xAA;
  29   1              ISPFD = 0x55;
  30   1              SCONF |= 0x06;          // Set ISP & 768 Byte Enable SFR
  31   1              EA      =       0;                                      //add by raleigh 20071025
  32   1      }
  33          //=========================================================================
  34          // ISP Disable
  35          //=========================================================================
  36          void EEPROM_Disable(void)
  37          {
  38   1              SCONF &= 0xFB;          // Set ISP Disable SFR
  39   1              EA      =       1;                                      //add by raleigh 20071025
  40   1      }
  41          
  42          void isp_program_byte(uint add, uchar dat)
  43          {
  44   1              uchar addh, addl;
  45   1              EEPROM_Enable();
  46   1              ISPFD = dat;
  47   1              add=add+0x3000;  //
  48   1              addh = add >> 8;
  49   1              addl = add & 0xff;
  50   1              ISPFAH = addh;
  51   1              ISPFAL = addl;
  52   1      
  53   1              ISPC = ISP_IAP_BYTE_PROGRAM;
  54   1              ISPC = ISP_IAP_BYTE_PROGRAM;
C51 COMPILER V7.06   SM_EEPROM                                                             10/31/2008 13:27:11 PAGE 2   

  55   1      
  56   1              ACC = 0;
  57   1              EEPROM_Disable();
  58   1      
  59   1      }
  60          void isp_erase_sector(uchar  num)
  61          {
  62   1      
  63   1              uchar addh, addl;
  64   1              num=0;
  65   1              EEPROM_Enable();        
  66   1      
  67   1              addh = 0x30;    //
  68   1              addl = 0x00;
  69   1              ISPFAH = addh;
  70   1              ISPFAL = addl;
  71   1      
  72   1              ISPC = ISP_IAP_SECTOR_ERASE;
  73   1              ISPC = ISP_IAP_SECTOR_ERASE;
  74   1      
  75   1              ACC = 0;
  76   1              EEPROM_Disable();       
  77   1      
  78   1      }
  79          
  80          
  81          
  82          
  83          
  84          
  85          
  86          
  87          
  88          
  89          
  90          
  91          
  92          
  93          
  94          
  95          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     84    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
